package com.netflexitysolutions.amazonws.sdb;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * This class is an immutable representation of an item attribute.
 *
 * @author D. Kavanagh
 * @author developer@dotech.com
 */
public class ItemAttribute {
	
	private String name;
	private boolean replace;
	private List<String> values = new ArrayList<String>(3);
	
	/**
	 * @param name
	 * @param value
	 * @param replace
	 */
	public ItemAttribute(String name, String value, boolean replace) {
		this.name = name;
		this.values.add(value);
		this.replace = replace;
	}

	/**
	 * @return
	 */
	public String getName() {
		return name;
	}

	/**
	 * @return
	 */
	public String getValue() {
		return values.isEmpty() ? null : values.get(0);
	}

	/**
	 * @return the values
	 */
	public List<String> getValues() {
		return Collections.unmodifiableList(values);
	}
	
	/**
	 * @param values the values to set
	 */
	public void addValue(String value) {
		this.values.add(value);
	}

	/**
	 * @return
	 */
	public boolean isReplace() {
		return replace;
	}
}
